<?php

namespace CMBUBank\UBank\Request\Account;

use CMBUBank\UBank\Request\UBankBaseRequest;
use CMBUBank\UBank\Response\Account\AccountPDFApplyResponse;

class AccountPDFApplyRequest extends UBankBaseRequest
{
    protected $code = 'ASYCALHD';

    protected $response = AccountPDFApplyResponse::class;

    protected $logTip = '电子回单异步查询';

    private $beginData;

    private $endData;

    private $account;

    private $excPageInfo;

    public function generate(): array
    {
        $data = [
            'primod' => 'PDF',
            'eacnbr' => $this->account,
            'begdat' => date('Y-m-d', strtotime($this->beginData)),
            'enddat' => date('Y-m-d', strtotime($this->endData)),
            'rrcflg' => '1',
            'rrccod' => '',
        ];

        if ($this->excPageInfo) {
            $data = array_merge($data, $this->excPageInfo);
        }

        return  $data;
    }

    public function setBeginData(string $beginData): void
    {
        $this->beginData = $beginData;
    }

    public function setEndData(string $endData): void
    {
        $this->endData = $endData;
    }

    public function setAccount(string $account): void
    {
        $this->account = $account;
    }

    public function setExtPageInfo(array $extPageInfo): void
    {
        $this->excPageInfo = $extPageInfo;
    }
}